<template>
  <div>

    <!-- 面包屑导航条 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>
      <el-row>
        
        <!--工具条-->
        <el-form :inline="true" :model="queryinfo" class="toolbar" label-position="right" label-width="70px">
          <el-row>
            <el-form-item label="手机号">
              <el-input v-model="queryinfo.password"></el-input>
            </el-form-item>
           <el-form-item label="订单编号">
              <el-input v-model="queryinfo.queryString"></el-input>
            </el-form-item>
            <el-form-item label="订单状态">
               <el-select v-model="queryinfo.queryId" placeholder="请选择" clearable>
                <el-option v-for="item in isAgainOrder" :label="item.name" :key="item.status" :value="item.status"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="">
              <el-button @click="getOrderList" type="success" style="width: 170px">查询</el-button>
            </el-form-item>
          </el-row>
        </el-form>
      </el-row>

      <el-table :data="orderlist" border stripe>
        <!-- <el-table-column type="index"></el-table-column> -->
        <el-table-column label="订单编号" prop="uuid" width="150"></el-table-column>
         <el-table-column label="买家姓名" prop="buyUserName" ></el-table-column>
         <el-table-column label="买家手机号" prop="buyUserMobile" ></el-table-column>
           <el-table-column label="卖家姓名" prop="sellUserName" ></el-table-column>
         <el-table-column label="卖家手机号" prop="sellUserMobile" ></el-table-column>
        <el-table-column label="CY单价（CNY）" prop="price" width="120"></el-table-column>
        <el-table-column label="CY出售数量" prop="numbers" width="100"></el-table-column>
         <el-table-column
                label="收款码">
                <template slot-scope="scope">
                 <el-image 
                    style="width: 50px; height: 30px;"
                    :src="scope.row.payImage" 
                     @click="checkimg(scope.row.payImage)">
                </el-image>
                </template>
                </el-table-column>
               
                 <el-table-column
                label="支付凭证（多张）">
                <template slot-scope="scope">
                 <el-image 
                    style="width: 50px; height: 30px;"
                    :src="scope.row.certificate[0]" 
                    :preview-src-list="scope.row.certificate">
                </el-image>
                </template>
                </el-table-column>
        <el-table-column label="总价（CNY）" width="100">
           <template slot-scope="scope">
            <!-- <el-tag type="danger" v-if="scope.row.pay_status === '0'" size="small">未付款</el-tag>
            <el-tag type="success" v-else size="small">已付款</el-tag> -->
            <span>{{getordermoney(scope.row)}}</span>
            <!-- <el-tag type="success" size="small"></el-tag> -->
          </template>
        </el-table-column>
        <el-table-column label="手续费费率" prop="fee" width="100"></el-table-column>
        <el-table-column label="手续费（CY）" prop="feeMoney" width="100"></el-table-column>
        <el-table-column label="CY交易总量" prop="feeMoney" width="100">
          <template slot-scope="scope">
            <!-- <el-tag type="danger" v-if="scope.row.pay_status === '0'" size="small">未付款</el-tag>
            <el-tag type="success" v-else size="small">已付款</el-tag> -->
            <span>{{getorderCynum(scope.row)}}</span>
            <!-- <el-tag type="success" size="small"></el-tag> -->
          </template>
        </el-table-column>
        <el-table-column label="订单状态" prop="pay_status">
          <template slot-scope="scope">
            <!-- <el-tag type="danger" v-if="scope.row.pay_status === '0'" size="small">未付款</el-tag>
            <el-tag type="success" v-else size="small">已付款</el-tag> -->
            <el-tag type="success" size="small">{{getorderStatus(scope.row)}}</el-tag>
          </template>
        </el-table-column>
        <!-- <el-table-column label="是否发货" prop="is_send"></el-table-column> -->
        <el-table-column label="下单时间" prop="createTime" width="140">
          <!-- <template slot-scope="scope">
            {{scope.row.create_time | dateFormat}}
          </template> -->
        </el-table-column>
        <el-table-column label="操作" >
          <template slot-scope="scope">
            <el-button type="success"  size="mini" v-if="scope.row.status == '6'" @click="chacke(scope.row)">查看</el-button>
            <!-- <el-button type="primary" icon="el-icon-edit" size="mini" title="修改订单地址" @click="addressDialogVisible=true"></el-button>
            <el-button type="success" icon="el-icon-location" size="mini" title="物流信息" @click="showWuliuDialog"></el-button> -->
          </template>
        </el-table-column>
      </el-table>

      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="queryinfo.pagenum" :page-sizes="[5, 10, 15, 20]" :page-size="queryinfo.pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total">
      </el-pagination>
    </el-card>

    <el-dialog title="修改地址" :visible.sync="addressDialogVisible" width="50%" @close="addressDialogClosed">
      <el-form :model="addressForm" :rules="addressFormRules" ref="addressFormRef" label-width="100px">
        <el-form-item label="省市区/县" prop="address1">
          <!-- 使用级联选择器，加载省市区县的数据 -->
          <el-cascader :options="cityData"></el-cascader>
        </el-form-item>
        <el-form-item label="详细地址" prop="address2">
          <el-input v-model="addressForm.address2"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addressDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addressDialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 物流信息的对话框 -->
    <el-dialog title="物流信息" :visible.sync="wuliuDialogVisible" width="50%">
      <el-steps direction="vertical" :active="1">
        <el-step v-for="(item, i) in wuliuInfo" :key="i" :title="item.time" :description="item.context"></el-step>
      </el-steps>
    </el-dialog>
    <el-dialog title="修改版本号" :visible.sync="dialogTableVisible1">
        <div class="apply">
            <el-breadcrumb separator-class="el-icon-arrow-right">
                <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
                <el-breadcrumb-item>申诉订单</el-breadcrumb-item>
                <el-breadcrumb-item>申诉详情</el-breadcrumb-item>
            </el-breadcrumb>
            <el-card>
              <el-collapse  @change="handleChange"  style="min-height:300px;">
                <el-collapse-item v-for="(item,i) in detileslist" :key="i" :title="item.reportMessage" :name="index">
                    <div>订单号：{{item.orderNo}}</div>
                    <div>申诉原因：{{item.reportMessage}}</div>
                    <div v-for="(itemImg,index) in item.reportPhotoList" :key="index">
                        <ul class="itemUl">
                            <li class="itemli" >
                                <!-- <el-image :src="itemImg" style="width: 100%;"></el-image> -->
                                <el-image 
                                    style="width: 100px; height: 100px"
                                    :src="itemImg" 
                                  >
                                </el-image>
                            </li>
                        </ul>
                    </div>
                    <div>买家：{{item.buyUserName}}</div>
                    <div>买家手机号：{{item.buyUserMobile}}</div>
                    <div>卖家：{{item.sellUserName}}</div>
                    <div>卖家手机号：{{item.sellUserMobile}}</div>
                </el-collapse-item>
              
                </el-collapse>
                <!-- <div></div> -->
                <div style="margin-top: 50px;">
                    <el-button size="medium" type="danger" @click="trundown()">拒绝</el-button>
                    <el-button size="medium" type="primary" @click="consent()">同意</el-button>
                </div>
            </el-card>
        </div>
    </el-dialog>
  </div>
</template>

<script>
import mix from "./Order-mixins.js";
export default {
  mixins: [mix]
};
</script>

<style lang="less" scoped>
.itemUl {
  list-style-type: none;
}
.itemUl .itemli {
  max-width: 300px;
}
</style>
